import com.google.appengine.api.datastore.*
//import com.google.appengine.api.datastore.Entity;

//import com.google.appengine.api.datastore.DatastoreServiceFactory;
//import com.google.appengine.api.datastore.DatastoreService
import groovyx.gaelyk.datastore.Entity
//import com.google.appengine.api.datastore.Entity


import groovyx.gaelyk.datastore.Key
import groovyx.gaelyk.datastore.Unindexed
import groovyx.gaelyk.datastore.Ignore


import groovy.json.*
import groovy.time.*

DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
def reportJSON = context.getResource("/json/izmir-earthquake-scenario-reports.json")
def categoriesJSON = context.getResource("/json/categories.json")

def slurper = new JsonSlurper()
def categories = slurper.parse(categoriesJSON)
def catMap = [:]

@Entity(unindexed=false)
class Person {
	@Key String t1
	String name
	int age
	//List [] kl	
	}

def e1 = new Person (
	t1: "123",
	name: "god", 
	//kl = ["om" , "tat"]
)



@Entity(unindexed=false)
class Pic {
	@Key String p1
	String urlt 
}


def p1 = new Pic (
     p1 : "271",
	urlt: "htmo"
	
	).save()



//System.out.println("e1.name " + e1.name + " key " + e1.getKey())

//System.out.println("Refreshing data, report count " +  e1.count()  )
def  g= Person.get( "123")
def p = Pic.get("271")

println "pic name $p.p1"
println g.name
println " g key " + g.key
//System.out.println("nm  $g.name" + " key is " + g.getKey())
//System.out.println("longitude " +  g.reportLocation.getLongitude()  )
//println "updated datastore"

//DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();

//Entity tom = new Entity("Person", "Tom");
//Key tomKey = tom.getKey();
//datastore.put(tom);


